The SCake SDK is a quick and easy way to set up integrations with Project Sugar Cake for making modules and accessing the API.

(_) How To Install (_)
Simply copy the "Mods" folder into the "Content" folder of your devkit / UE5 environment, then load up your usual project. (The assets are uncooked, so they import directly and can be accessed easily)

(_) Usage Instructions (_)
The SDK provides 'dummy' files/assets you point your mod to, then when you export your mod and load it in-game with Project Sugar Cake also installed, the mod will access the SCake API and trigger the appropriate functions/effects. DO NOT include the SDK files with your mod, this will break SCake and the API, I've set up an asset label that should keep it separated, but double check the chunkID to make sure it doesn't conflict with your mod if you use the packaging method!

When importing the SDK, do not change the file path/structure for the ProjectSugarCake folder! The file path must match exactly in order for the API to work properly (also don't change the DataStructure folder at all). The Data Structure folder has internal structure files for SCake required to properly compile certain API functions. Technically, if you don't wish to install the API or have issues with the provided one, you can still create a "dummy actor" in the appropriate folder and re-create the functions/events seen in the SDK to still access the functions properly. Similarly if there are API functions you're not using you can remove them from your instance of the SDK if you ever find a reason to do so. (This can be useful if an update broke a certain function and the SDK hasn't been updated to fix it yet)


~!~ API Explaination ~!~

References (Variables and Data)
	SCakeReference / ProjectSugarCake
		This is the reference to the Sugar Cake API and mod itself, you'll need a reference to SCake in-order to use any of the API functions
	
	EventReference / EventComp
		These are references to an instance of the Animation Player. This handles all animation playback and stores data related to that specific event. These are volitile after an animation ends so make sure to pull any needed data before the animation ends (or if pulling from an animation end call, grab and store the data immediately to avoid losing it!)
			- I recommend grabbing whatever data you need before the event ends, then just listen for the end event trigger and compare the reference. This is an effectively 'free' process and avoids issues.
	
	"Pal"
		For our purpose I've just labeled all characters internally as pals, including humans. If something references 'Pal' it means I'm referencing "PalCharacter" which is an internal Palworld class used for pretty much all actors in the game.

Events

	SCake_RegisterAnim
		Call to register an array of animations, invalid data may cause animations not to register
			RegisterAnimData [SCake_RegAnim_Struct]
				Array of animations you'd like to send to the register

	SCake_RegisterAnimEvent
		Call to register an array of animation events, invalid data may cause animation events not to register
			RegisterAnimEventData [SCake_RegAnimEvent_Struct]
				Array of animation events you'd like to send to the register

	SCake_RegisterAllJSON
		(Note : This function runs automatically when the mod loads up so you do not need to call this unless you alter the _LoadList afterward.)
		Registers all .json files in the _LoadList, call when registering new animations through the .json install method.
		
	SCake_SendReportMessage
		Passes a message for SCake to display in the ReportUI
			Message [String]
				Message to display

	SCake_StopAnim_PalTarget
		Stops any animation event the selected pal is involved in
			PalReference [Pal Character Reference]

	SCake_StopAnim_EventRef
		Attempts to stop the specificed Animation Event by reference
			EventReference [EventComp Reference]
		
Functions
	SCake_StartAnimEvent_Basic
		Starts an animation with minimal information. If no event ID is supplied (is either "None" or "Random") a random compatible animation will play instead
			PalList [Pal Character Reference]
				List of characters to include in the animation, can include humans or pals (including players)
			EventID [Name]
				[Optional] Animation Event to play, if is invalid or none is supplied a random compatible animation will be selected to play
			NonErotic [Boolean]
				[Optional] If no EventID is supplied, this determines if the random animation selected should be NonErotic (Overwritten by EventID if valid)

	SCake_StartAnimEvent_Advanced
		Starts an animation with more advanced information. If no event ID is supplied (is either "None" or "Random") a random compatible animation will play instead.
			PalList [Pal Character Reference]
				List of characters to include in the animation, can include humans or pals (including players)
			EventID [Name]
				[Optional] Animation Event to play, if is invalid or none is supplied a random compatible animation will be selected to play
			NonErotic [Boolean]
				[Optional] If no EventID is supplied, this determines if the random animation selected should be NonErotic (Overwritten by EventID if valid)
			Tags [Name Array]
				[Optional] Tags to search for when finding animations to play
			RequireAllTags [Boolean]
				[Optional] Whether all tags are required for an animation is compatible, if false then only a single tags is required
			Exclude Tags [Name Array]
				[Optional] Tags that invalidate animations as compatible, excluding them from results
			AnimRootTransform [Transform]
				Location where the animation should play (Can use a character's mesh world transform if desired)

	SCake_GetEventCompParams
		Returns variables from the provided EventReference
			EventReference [EventComp Reference]
				The Animation Event Reference you wish to pull data from
			Returns : PalList [Pal Character Reference Array]
				Returns a list of characters in the Animation Event in Slot Order
			Returns : NonErotic [Boolean]
				Returns if the animation is NonErotic (if you're triggering sex effects or only want Erotic animations, make sure to check if this for false)
			Returns : AnimRoot [Transform]
				Returns the world position for the animation before any offsets (if you need character positions it's better to use their reference directly)

	SCake_Stat_AddPleasure
		Adds Sexual Pleasure to the referenced character
				PalReference [Pal Character Reference]
					Character to add Sexual Pleasure to
				AmountToAdd [Float]
					Amount of Sexual Pleasure to add
				Returns : PleasureOutput [Float]
					The new amount of Sexual Pleasure the referenced character

	SCake_CheckStat_Pleasure
		Returns the current Sexual Pleasure of the referenced character
			PalToCheck [Pal Character Reference]
				Which character to check the Sexual Pleasure of
			Returns: SexualPleasure [Float]
				The Sexual Pleasure of the checked character

	SCake_GetPalAnim
		Checks if the given pal is in an animation and if so returns the Event Reference
			PalReference [Pal Character Reference]
				Pal Character reference to search through the playering Animation Event List for
			Returns : InAnimation [Boolean]
				Whether the character was found in the playing Animation Event List
			Returns : EventReference [EventComp Reference]
				If InAnimation was true, returns the EventComp Reference

	SCake_InterpretError
		Takes the Name variable from an error and translates it into a human readable string for use in either UI elements or easier debugging
			ErrorInput [Name]
				The raw error name variable from SCake
			Returns : ReadableOutput [String]
				Readable string ready for use

Dispatchers
	SCake_ED_AnimStart
		Called whenever an Animation Event starts and returns a reference to it (Store this value if you need to reference it later, use the API call 'SCake_GetEventCompParams' to pull data from the event, store it if needed)
			Returns : EventReference [EventComp Reference]

	SCake_ED_AnimEnd
		Called whenever an Animation Event starts and returns a refernece to it (It's recommended to pull data immediately using 'SCake_GetEventCompParams' if needed as EventReferences become volitile after an Animation Event Ends, I recommend mostly using this reference to compare to stored references from other API calls)
			Returns : EventReference [EventComp Reference]